import { ref } from "vue";
import { Material } from "@/api/interface";
import { materialList } from "@/assets/mock/mockData";

// 筛选出自制类型的物料
export const getSelfMade = (materials: Partial<Material.ResMaterial>[]) => materials.filter(item => item.sourceType === 1);

// 自制物料列表
export const selfMadeList = ref(getSelfMade(materialList.value));

// 筛选出外购类型的物料
export const getPurchased = (materials: Partial<Material.ResMaterial>[]) => materials.filter(item => item.sourceType === 2);

// 外购物料列表
export const purchasedList = ref(getPurchased(materialList.value));
